import org.bukkit.event.player.PlayerJoinEvent;
import java.util.Timer;
import java.util.TimerTask;
public class tabMain implements Listener {
    @EventHandler
    public void qwq(PlayerJoinEvent event) {
        Timer timer = new Timer();
        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                Player player = event.getPlayer();
                String name = player.getName();
                int ping = player.getPing();
                String formatPing = ChatColor.GREEN + "20";
                try {
                    if (ping <= 100) {
                        formatPing = ChatColor.GREEN + "极佳[" + ping + "]";
                    } else if (ping > 100 & ping <= 200) {
                        formatPing = ChatColor.YELLOW + "正常[" + ping + "]";
                    } else if (ping > 200) {
                        formatPing = ChatColor.RED + "信号弱[" + ping + "]";
                    }
                } catch (NullPointerException ignore) {
                }
                int o = rank.getRank(player);
                String formatName = "Null";
                try {
                    if (o == 0) {
                        formatName = ChatColor.GRAY + name;
                    }else if (o == 1) {
                        formatName = ChatColor.GREEN + "[VIP]" + name;
                    }else if (o == 2) {
                        formatName = ChatColor.GREEN + "[VIP+]" + name;
                    }else if (o ==3) {
                        formatName = ChatColor.AQUA + "[MVP]" + name;
                    }else if (o ==4) {
                        formatName = ChatColor.AQUA + "[MVP+]" + name;
                    }else if (o == 621) {
                        formatName = ChatColor.LIGHT_PURPLE + "[Gemini]" + name;
                    }
                }catch (NullPointerException ignore) {
                }
                player.setPlayerListHeader(ChatColor.LIGHT_PURPLE + "繁星梦 Minecraft 服务器");
                player.setPlayerListFooter(ChatColor.AQUA + "欢迎！" + formatName + ChatColor.AQUA + ". 祝你游戏愉快！\n网络质量:" + formatPing);
            }
        },100,3000);
    }

}
